emoji: Use a portable and configuration-dependent path to load the data
authorMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 6 May 2021 13:32:44 +0000 (15:32 +0200)
committerMarco Trevisan (Treviño) <mail@3v1n0.net>
Thu, 6 May 2021 14:00:06 +0000 (16:00 +0200)
Load the emojis data in all the platforms, respecting the configured
GTK_DATA_PREFIX

gtk/gtkemojichooser.c

index 646be90ed391400bfa1186932844db8b445d790f..9a1e11b450f2c7f40453a68987d179db54c76bf9 100644 (file)
@@ -627,11 +627,15 @@ get_emoji_data (void)
   if (g_error_matches (error, G_RESOURCE_ERROR, G_RESOURCE_ERROR_NOT_FOUND))
     {
       char *filename;
+      char *gresource_name;
       GMappedFile *file;
 
       g_clear_error (&error);
 
-      filename = g_strconcat ("/usr/share/gtk-4.0/emoji/", lang, ".gresource", NULL);
+      gresource_name = g_strconcat (lang, ".gresource", NULL);
+      filename = g_build_filename (_gtk_get_data_prefix (), "share", "gtk-4.0",
+                                   "emoji", gresource_name, NULL);
+      g_clear_pointer (&gresource_name, g_free);
       file = g_mapped_file_new (filename, FALSE, NULL);
 
       if (file)